package com.sky.mapper;

import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {

    /**
     *  查询用户点餐信息
     * @param shoppingCart 用户的 ID 菜名 口味
     * @return 返回点餐信息
     */
    List<ShoppingCart> selectByAllshoppingCart(ShoppingCart shoppingCart);

    /**
     *  修改 菜品数量
     * @param dbShoppingCart
     */
    @Update(" update shopping_cart set number =#{number} where id=#{id}")
    void updateShoppingCart(ShoppingCart dbShoppingCart);

    void insertShoppingCart(ShoppingCart dbShoppingCart);

    @Delete("delete from shopping_cart where user_id = #{userId}")
    void deleteByUserId(Long userId);
}
